import React, {useContext} from 'react';
import {View} from 'react-native';
import {Button, Text, ListItem, Avatar} from '@rneui/base';
import {useMount} from 'ahooks';
import {useNavigation} from '@react-navigation/native';
import {useSelector, useDispatch} from 'react-redux';
import {setKeyGetAccountInfo} from '@/store';
import GlobalContext from '@/GlobalContext';
import SetPhoto from './SetPhoto';
const leftIconSize = 18;
const rightIconSize = 20;
export default () => {
  const dispatch = useDispatch();
  const accountInfo = useSelector(state => state.accountInfo.value);
  const navigation = useNavigation();
  return (
    <>
      <SetPhoto />
      <ListItem
        onPress={async () => {
          navigation.push('MinePersonSetNickname');
        }}
        style={{
          marginTop: 1,
        }}>
        <Text>昵称</Text>
        <View
          style={{
            flex: 1,
            flexDirection: 'row',
            alignItems: 'center',
            justifyContent: 'flex-end',
          }}>
          <Text>{accountInfo?.j_ext_info?.nickname || '---'}</Text>
        </View>
        <ListItem.Chevron size={rightIconSize} />
      </ListItem>
    </>
  );
};
